package com.crm.customers.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.crm.base.dao.BaseDao;
import com.crm.customers.dao.CommissionCustomerDao;
import com.crm.customers.model.CommissionCustomer;

@Repository("commissionCustomerDao")
public class CommissionCustomerDaoImpl extends BaseDao implements CommissionCustomerDao {
	
	private  static final String MAPPER_NAMESAPCE = "CommissionCustomerMapper.";

	@Override
	public int saveCommissionCustomer(CommissionCustomer cc) {
		return insert(MAPPER_NAMESAPCE+"saveCommissionCustomer", cc);
	}

	@Override
	public List<CommissionCustomer> getAllComCusListByParams(CommissionCustomer cc) {
		List<CommissionCustomer> list = selectList(MAPPER_NAMESAPCE+"getAllComCusListByParams", cc);
		if (list != null && list.size() > 0) {
			list.get(0).setTotalResults((Integer)selectOne(MAPPER_NAMESAPCE+"getAllComCusListCountByParams", cc));
		}
		return list;
	}

	@Override
	public List<CommissionCustomer> getCCInfoByParams(CommissionCustomer cc) {
		return selectList(MAPPER_NAMESAPCE+"getCCInfoByParams", cc);
	}

	@Override
	public int updateCCinfo(CommissionCustomer cc) {
		return update(MAPPER_NAMESAPCE+"updateCCinfo", cc);
	}

}
